import userStore from '../../common/js/userStore';

/**
 * 设置路由切换loading状态
 * @param state
 * @param flag
 */
export const setLoading = function(state, flag) {
  state.loading = flag;
};
/**
 * 设置当前模块的路由地址
 * @param state
 * @param path
 */
export const setRouter = function(state, router) {
  if (router) {
    state.router = router;
  }
};
/**
 * 设置侧边栏状态
 * @param state
 */
export const setSidebarVisible = function(state) {
  state.sidebarVisible = !state.sidebarVisible;
};
/**
 * 退出登录销毁用户信息
 * @param state
 */
export const logOff = function(state) {
  userStore.delUser();
  state.destory = true;
};
